﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenNETCF.MTConnect;
using OpenNETCF.IoC;
using MachineSimulator.Interfaces;

namespace SimulatorAdapter
{
    public class Controller : HostedControllerBase
    {
        private bool m_estop;

        internal Path Path { get; set; }

        public Controller()
        {
            this.ID = "controller";
            Path = new Path();
            this.Components.Add(Path);
        }

        [EventDataItem(
            ItemType = DataItemType.EMERGENCY_STOP
            )]
        public bool EStop
        {
            get { return m_estop; }
            set
            {
                // only publish value changes
                if (value == m_estop) return;

                // store the new value
                m_estop = value;

                // calling this will notify the underlying Agent engine to publish this value out the MTConnect protocol interface
                RaisePropertyChanged("EStop");
            }
        }
    }
}
